Skip to content

Fix/ss opm faithful - #69

Merged
VladimirShitov merged 3 commits into
mainfrom
fix/ss_opm-faithful
Sep 23, 2026
Merged

VladimirShitov merged 3 commits into
mainfrom
fix/ss_opm-faithful

Conversation

@VladimirShitov

Copy link
Copy Markdown
Contributor

Update ss_opm model for better scalability and performance. Fixed the following problems of the previous implementation:

  1. Per-cell metadata features fed raw instead of standardized; the batch cell count put every test cell out of distribution.
  2. The 2021 batch label's donor was taken as the day; 2022 labels did not match at all.
  3. All 14k-22k genes were appended as raw CITE features instead of the original's ~70 HGNC/Reactome-selected genes (96 GB peak, different model).
  4. 42 zero-protein training cells on 2022 made the correlation loss NaN from epoch 0.
  5. Dense float64 copies of the 130k x 23k target matrix OOM-killed 2022 ATAC→GEX.
  6. Predictions in per-cell z-score space, so RMSE and Spearman were meaningless.

Checklist before requesting a review

  • I have performed a self-review of my code

  • Check the correct box. Does this PR contain:

    • Breaking changes
    • New functionality
    • Major changes
    • Minor changes
    • Bug fixes
  • Proposed changes are described in the CHANGELOG.md

  • CI Tests succeed and look good!

VladimirShitov and others added 2 commits September 20, 2026 14:11
…ithful

The wrapper fed the network raw per-cell statistics and the raw batch cell
count (thousands in training, tens for the subsampled test batches), took the
donor of the NeurIPS 2021 batch labels for the day, appended all genes instead
of the original's ~70 HGNC/Reactome-selected genes as raw CITE features, kept
cells without any protein counts (NaN loss on the 2022 CITE data), upcast the
dense multiome targets to float64 (OOM on 2022 ATAC->GEX) and returned the
model's per-cell z-scores as predictions.

- per-cell statistics as in make_additional_files.py (quartiles of the
  non-zero values, log1p ratio for multiome), standardized over train+test
- CITE batch singular vectors from per-batch gene medians, standardized over
  the training batches, test-only batches projected; cell ratios and cell
  count constant (no cell types in the task files, subsampled test set)
- day/donor regexes default to the {day}_{donor} labels of NeurIPS 2022,
  constant otherwise
- CITE gene masks rebuilt with the original thresholds from HGNC (Ensembl id
  -> symbol) and Reactome, downloaded into the image
- training cells with a constant target vector dropped
- dtype-preserving, zero-row-safe patches of the ss_opm normalizers
- predictions mapped to the target scale by a global affine fit on training
  cells (correlations unchanged)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The mask construction correlates every candidate gene with all proteins at
once via rankdata instead of a full spearmanr matrix per gene (identical
values, minutes instead of hours on 14k genes). Bundles written before the
metadata rebuild are read with neutral defaults so the pre-trained test
resources keep working until they are regenerated.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@benjaminfreyuu benjaminfreyuu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, at least the changes made. I am not so familiar with method, so limited trustworthiness in assessing this

test_inputs_values=_test_inputs_for_svd,
test_metadata=_test_metadata_for_svd,
test_inputs_values=test_inputs if test_inputs is not None else train_inputs,
test_metadata=test_metadata if test_metadata is not None else train_metadata,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this correct? Why is there an else train_metadata/ train_inputs for the test case

…D on train only without a test set

reactome.org answers HTTP 403 to Python's default urllib user agent, which
failed the docker image build of ss_opm_train in CI (PR #69). Both the
image-build step and the runtime fallback now send `User-Agent: Mozilla/5.0`.

`fit_preprocess` no longer receives the training set again in place of a
missing test set: the original's `use_test_inputs` switch is set from whether
`--input_test_mod1` was given (review comment on #69). CHANGELOG entry added.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@VladimirShitov
VladimirShitov merged commit be43c9b into main Sep 23, 2026
3 checks passed
@VladimirShitov
VladimirShitov deleted the fix/ss_opm-faithful branch September 23, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants